﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ComputerizedRehabForms
{
    public partial class BLBResultsForm : Form
    {
        public BLBResultsForm()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            /*
             * All of the work for the results page is done in this method
             * First, a copy of each line from the Test page is drawn in the same location as the test line
             * Next, a vertical green line is drawn at the midpoint of each line
             * Finally, a red X is drawn at the first 17 spots the mouse was clicked
             */
            base.OnPaint(e);
            Graphics g;
            
            g = e.Graphics;

            Pen myPen = new Pen(Color.Red);
            myPen.Width = 3;

            /* Draw the outer third of every line in RED */

            for (int i = 0; i < 17; i++)
            {

                g.DrawLine(myPen, BLBTestForm.lines[i][0], BLBTestForm.lines[i][2], BLBTestForm.lines[i][1], BLBTestForm.lines[i][2]);
            }

            /* Draw the middle third of every line in YELLOW */

            myPen.Color = System.Drawing.Color.Goldenrod;
            for (int i = 0; i < 17; i++)
            {

                g.DrawLine(myPen, BLBTestForm.lines[i][0] + (BLBTestForm.lines[i][3] / 6), BLBTestForm.lines[i][2], BLBTestForm.lines[i][1] - (BLBTestForm.lines[i][3] / 6), BLBTestForm.lines[i][2]);
            }


            /* Draw the inner third of every line in GREEN */

            myPen.Color = System.Drawing.Color.Green;
            for (int i = 0; i < 17; i++)
            {

                g.DrawLine(myPen, BLBTestForm.lines[i][0] + (BLBTestForm.lines[i][3] / 3), BLBTestForm.lines[i][2], BLBTestForm.lines[i][1] - (BLBTestForm.lines[i][3] / 3), BLBTestForm.lines[i][2]);
            }

            /*Draw all of the midpoint lines, in green*/
            myPen.Color = System.Drawing.Color.Green;
            for (int i = 0; i < 17; i++)
            {
                g.DrawLine(myPen, BLBTestForm.midpoint_x[i], BLBTestForm.midpoint_y[i] +25, BLBTestForm.midpoint_x[i], BLBTestForm.midpoint_y[i] -25);
            }
            
            /*Draw all of the mouse click X's, in black*/
            myPen.Color = System.Drawing.Color.Black;
            for (int i = 0; i < 17; i++ )
            {
                //if the backbutton is hit undo the last click.
                
                    g.DrawLine(myPen, BLBTestForm.mouse_x[i] - 10, BLBTestForm.mouse_y[i] - 10, BLBTestForm.mouse_x[i] + 10, BLBTestForm.mouse_y[i] + 10);
                    g.DrawLine(myPen, BLBTestForm.mouse_x[i] - 10, BLBTestForm.mouse_y[i] + 10, BLBTestForm.mouse_x[i] + 10, BLBTestForm.mouse_y[i] - 10);

                }

            
        }

        private void BLBResultsForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }
        
        private void save_button_Click_1(object sender, EventArgs e)
        {

        }

        private void no_save_button1_Click(object sender, EventArgs e)
        {
            DataManager.showExit();
        }

        private void BLBResultsForm_Load(object sender, EventArgs e)
        {

        }
    }
}
